package com.sell.utils;

import com.sell.VO.ResultVO;
import com.sell.enums.ResultEnum;

/**
 * ResultVO工具类
 * @author: lichujun
 * @date: 2018年8月8日 0008
 */
public class ResultVOUtil {

    /** 成功时返回 **/
    @SuppressWarnings("unchecked")
    public static ResultVO success(Object object) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(ResultEnum.SUCEESS.getCode());
        resultVO.setMsg(ResultEnum.SUCEESS.getMsg());
        resultVO.setData(object);
        return resultVO;
    }

    public static ResultVO success() {
        return success(null);
    }

    /** 出现错误返回 **/
    public static ResultVO error(Integer code, String msg) {
        ResultVO resultVO = new ResultVO();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }
}
